package com.hsnn.medstgmini.base.dict.model;

import java.sql.Timestamp;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;



/**
 * @category 规格实体类
 * @author 韩守松
 * @date 2015年6月24日
 */
@Entity
@Table(name="dic_drugspec"
)

public class DicDrugspec  implements java.io.Serializable {


    // Fields    

     /**
	 * 
	 */
	private static final long serialVersionUID = 1943282413797782976L;
	private String specId;//规格id
    private String specCode;//规格编码
    private String specName;//规格
    private String fatherId;//规格父id
    private Short status;//状态
    private Timestamp updDatetime;//更新时间
    private String updUser;//更新人
    private Short sortId;//排序
     
	private long count;
 
	private DicDrugspec fatherCode;//规格对象
    

	/** default constructor */
    public DicDrugspec() {
    }


	/** minimal constructor */
    public DicDrugspec(String specCode, String specName) {
        this.specCode = specCode;
        this.specName = specName;
    }
    
    /** full constructor */
    public DicDrugspec(String specCode, String specName, String fatherId, Short status, Timestamp updDatetime, String updUser, Short sortId) {
        this.specCode = specCode;
        this.specName = specName;
        this.fatherId = fatherId;
        this.status = status;
        this.updDatetime = updDatetime;
        this.updUser = updUser;
        this.sortId = sortId;
    }

   
    // Property accessors

    @Id
    @GenericGenerator(name="generator", strategy="uuid")
    @GeneratedValue(generator="generator")
    @Column(name="spec_id", unique=true, nullable=false, length=36)

    public String getSpecId() {
        return this.specId;
    }
    
    public void setSpecId(String specId) {
        this.specId = specId;
    }
    
    @Column(name="spec_code", nullable=false, length=10)

    public String getSpecCode() {
        return this.specCode;
    }
    
    public void setSpecCode(String specCode) {
        this.specCode = specCode;
    }
    
    @Column(name="spec_name", nullable=false, length=100)

    public String getSpecName() {
        return this.specName;
    }
    
    public void setSpecName(String specName) {
        this.specName = specName;
    }
    
    @Column(name="father_id",insertable = false,updatable = false, length=36)

    public String getFatherId() {
        return this.fatherId;
    }
    
    public void setFatherId(String fatherId) {
        this.fatherId = fatherId;
    }
    
    @Column(name="status")

    public Short getStatus() {
        return this.status;
    }
    
    public void setStatus(Short status) {
        this.status = status;
    }
    
    @Column(name="upd_datetime", length=19)

    public Timestamp getUpdDatetime() {
        return this.updDatetime;
    }
    
    public void setUpdDatetime(Timestamp updDatetime) {
        this.updDatetime = updDatetime;
    }
    
    @Column(name="upd_user", length=36)

    public String getUpdUser() {
        return this.updUser;
    }
    
    public void setUpdUser(String updUser) {
        this.updUser = updUser;
    }
    
    @Column(name="sort_id")

    public Short getSortId() {
        return this.sortId;
    }
    
    public void setSortId(Short sortId) {
        this.sortId = sortId;
    }
   

    @ManyToOne(cascade=CascadeType.REFRESH)
    @Fetch(FetchMode.JOIN)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name = "father_id")
	public DicDrugspec getFatherCode() {
		return fatherCode;
	}

	public void setFatherCode(DicDrugspec fatherCode) {
		this.fatherCode = fatherCode;
	}


    @Transient
    public long getCount() {
		return count;
	}


	public void setCount(long count) {
		this.count = count;
	}


}